package com.pzhu.gmall.user.controller;

import java.util.List;

import com.pzhu.gmall.bean.UmsMemberReceiveAddress;
import com.pzhu.gmall.bean.UserMember;
import com.pzhu.gmall.service.UserService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 刘鹏 liupeng
 * @date 2019/10/21
 **/
@RestController
public class UserController {

    @Reference
    UserService userService;

    @GetMapping("/users")
    public List<UserMember> getAllUser() {
        List<UserMember> userMembers = userService.getAllUser();
        return userMembers;
    }

    @GetMapping("/user/Address")
    public List<UmsMemberReceiveAddress> getAddressesByUserId(String id) {
        List<UmsMemberReceiveAddress> addresses = userService.getAddressesByUserId(id);
        return addresses;
    }

    @RequestMapping("index")

    public String index() {
        return "hello world";
    }
}
